<template>
  <div>
    <div class="search-wrap">
      <van-sidebar v-model="active">
        <van-sidebar-item title="标签名称" />
        <van-sidebar-item title="标签名称" />
        <van-sidebar-item title="标签名称" />
      </van-sidebar>
      <div class="search-content" ref="root">
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
        <h1>内容1</h1>
      </div>
    </div>

  </div>
</template>

<script>
  import {
    ref
  } from 'vue';
  import {
    useScrollParent,
    useEventListener
  } from '@vant/use';
  export default {
    setup() {
      const active = ref(0);
      const root = ref();
      const scrollParent = useScrollParent(root);

      useEventListener(
        'scroll',
        () => {
          console.log('scroll');
        }, {
          target: scrollParent
        }
      );
      return {
        active,
        root
      };
    },
  }
</script>

<script setup>
</script>
<style lang="less" scoped>
  .search-wrap {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background: #f8f8f8;

    .search-content {
      width: 72%;
      height: 100%;
      padding: 0 10px;
      background: #fff;
      overflow-y: scroll;
    }
  }
</style>